The following sections provide updates and corrections to the Delphi
documentation set.
Getting Started
===============
The demonstration application makes use of the Object Repository. Note
that the screenshots of the repository and its user interface have been
updated somewhat since this book went to print. Correct documentation can be found in the User's Guide, the Database Application Developer's Guide, and the online help.
Component Writer's Guide
========================
p. 36
If your property type derives from TComponent, you should use the
FreeNotification method to ensure that your objects receive a call to Notification when the assigned component is destroyed. This method enables all ancestor objects to update shared properties appropriately. Even if you think you do not need to worry about shared properties, you should call FreeNotification to be safe. Calling FreeNotification adds no overhead to your application if the call is not necessary.
To prevent a component from being inherited, subtract the csInhertitable
value from its FComponentStyle property when you create the component:
For an example that demonstrates both FreeNotification and prevention of
inheritance, see \DEMOS\DEMOLBL\DEMOLBL.PAS.
User's Guide
============
p. 51
You can nest forms within other forms. To nest a form, specify a form's
parent form in its Parent property.
p. 117
If you build a project as a DLL that contains modeless forms,and you want to use the DLL both as a standard DLL callable from other executables and as a standalone application, you must provide two entry points for the DLL.
The entry point called by the stub .EXE that runs a DLL as a standalone executable must include a call to CreateHandle to create an application handle before it creates modeless forms and runs the application.
Applications that call the DLL must call a separate initialization entry point, and must pass an application handle into the DLL. The DLL must assign the application's handle to its own internal handle before creating modeless forms.
The Database Explorer is an example of a DLL that functions as a standalone application and a DLL used by another application (Delphi).
p. 243
The String List editor, available at design time, continues to support
loading a list of strings from a file. To load a file, right click in the
editor to invoke the pop up menu, and choose Load from File.
Object Pascal Language Guide
============================
p. 29
The default calling convention is always register. The manual incorrectly
states that the default changes depending on the use of optimizations.
Database Application Developer's Guide
======================================
pp. 24-29
If you create multi-threaded database applications, note than TDatabase
and TDataSet components are bound to their individual TSession components.
For example, you cannot use a TBatchMove component to move information
in a dataset associated with Session1 to a dataset associated with Session2.
You can, however, write application-level code to accomplish such a move. For example, you could read a record from a dataset in Session1 into standard controls, then write the information from those controls into controls associated with a dataset in Session2.
pp. 29-31
Using threads with TQuery and TTable components.
Data-access components, unlike all other VCL components, can be created
and accessed within the context of threads you create. To create and
access a database component within the context of a thread:
1. The component must have its own session.
2. The component's session can be accessed by only one thread at a
time.
3. The component's creator must be nil, or must be the owner of the
thread.
A component created in the context of one thread cannot be accessed by other threads. A component created in the context of the main VCL thread (the default thread) that is also associated with a session, however, can be accessed by one other thread at a time.
You might use this capability to open a long-running query in the background of a database application.
pp. 61-62
To reference a field name that contains embedded spaces in an OnFilterRecord event handler enclose the field name in square brackets [].
pp. 65, 67
The Cancel and Abort methods for a dataset are correctly documented, but
there may be some confusion about them. Cancel immediately terminates
editing or inserting of the current record. It is usually invoked by an
application user from a TDBNavigator control. Abort prevents other methods, such as Open, Insert, or Delete, from executing. Abort is usually invoked in event handlers such as BeforeOpen, BeforeInsert, or BeforeDelete.
p. 66
The example code for updating a record makes a call to a non-existent method, SetRecords. SetRecords should be SetFields.
p. 85-86
When creating an extended attribute set based on a TField component, set
only those properties that are to be the same for each field to which the attribute set is applied. Do not set property values that should be unique for each field, such as DisplayLabel.
p. 99
The first sentence under the heading "Searching on alternative indexes"
omits a word. The corrected sentence is as follows:
"If you want to search on an index other than the primary index for a
table, then you must specify the name of the index to use in the IndexName property for the table."
p. 118
The documentation incorrectly states that a live result set cannot be
returned from a SELECT statement that contains an ORDER BY clause.
p. 131
The AutoSize property of a TDBText control cannot be set to True when the control is used in a TDBCtrlGrid component.
pp.136-140
TDBLookupListBox and TDBLookupComboBox now have the ReadOnly property like other data-aware controls.
TDBLookupListBox and TDBLookupComboBox can display multiple columns.
The ListField property is now a semicolon-separated list of field names
which specifies the columns to show in the list box. When more than one
field name is specified, the widths of all but the last column are
calculated from the DisplayWidth properties of the underlying TField
objects. The width of the last column (the only column in the single
column case), is simply the space that remains to the right of the
preceeding columns (or the entire with of the control in the single
column case).
An additional property, ListFieldIndex, specifies a zero-based index into the list of field names in the ListField property. The field given by ListFieldIndex is the "primary" field of the lookup control. For both list boxes and combo boxes, this is the field that controls incremental searching (the automatic searching that takes place when the user types the first few characters of a value). For the TDBLookupComboBox, ListFieldIndex also controls which field is displayed in the combo box.
When a TDBLookupListBox or TDBLookupComboBox control is attached to a
lookup field (the DataSource and DataField properties specify a lookup field), the ListFieldIndex property is ignored, and the "primary" field is always the ResultField of the underlying lookup field. Furthermore, when attached to a lookup field, if the ResultField of the underlying lookup field is not included in the list of columns given by ListField, the ResultField is automatically displayed as the first column.
You can choose not to provide a value for the DataSource property to TDBLookupListBox and TDBLookupComboBox. If you do not, then values returned in the KeyValues field can be examined and used in the controls' OnChange event.
Two additonal properties and two addtional events have been added to TDBLookupComboBox.
The DropDownWidth property specifies the width of the drop down list in pixels. A value of zero (the default) causes the drop down list to have the same width as the combo box.
The DropDownAlign property can be daLeft, daRight, or daCenter, and specifies whether the drop down list should be left aligned (the default), right aligned, or centered.
The OnDropDown event occurs immediately before the list drops down. It is a convenient place to modify the DropDownAlign, DropDownRows, and DropDownWidth properties.
The OnCloseUp event occurs immediately after the drop down list is closed.
p. 152
The TDBGrid.Options.dgMultiSelect property was added to the TDBGrid component after the Database Application Developer's Guide went to print. If dgMultiSelect is True (the default), users can select multiple rows in a grid using the following techniques:
-- Shift + Arrow Keys
-- Ctrl + Mouse clicks
Shift + Click is not supported.
Selected rows are maintained as bookmark strings in a TBookMarkList object. Use the following properties and methods to work with a bookmark list for a grid:
Property Purpose
-------- ----------------------------------
SelectedRows.Count Determine the number of selected
rows.
SelectedRows.CurrentRowSelected True if the current row is one of
the selected rows.
SelectedRows.Refresh Iterate through bookmark list to
make sure each selected row still
exists in the dataset; delete
bookmarks that no longer point to
valid rows. Returns True if
bookmarks are deleted, False
otherwise.
SelectedRows.Clear Clear all bookmarks. Cancel
selection.
SelectedRows.Delete Deletes selected rows without
asking user for confirmation.
Ctrl+Delete also deletes selected
rows, but prompts first for
confirmation if dgConfirmDelete is
True.
SelectedRows.Find Finds a specific bookmark string.
SelectedRows.IndexOf Returns the index of a specified
bookmark, if it exists.
In a multi-user environment keep in mind that the more rows that are selected, and the longer the rows remain selected, the greater the chance that bookmarks may no longer point at valid rows in a dataset. Use TDBGrid.SelectedRows.Refresh to eliminate invalid bookmarks in these cases.
DO NOT use the GoToBookMark method of TTable to move to a selected bookmark in a grid. Use TDBGrid.SelectedRows.Find instead.
DO NOT stream bookmark strings.
To read or write the current set of bookmarks for a dataset, use the TDataSet.BookMark property.
p. 153
The ability to edit in a grid is also determined by the settings for TDBGrid.Options.dgEditing and TDBGrid.Options.dgAlwaysShowEditor. To enable editing, TDBGrid.Options.dgEditing must be True (the default).
To indicate that editing is enabled, TDBGrid.Options.dgAlwaysShowEditor must also be True. Note that if dgAlwaysShowEditor is False, editing is still possible.
p. 156
TDBCtrlGrid is a property of type TDBCtrlGridOrientation.
pp. 157-158
TReport properties that used to return Boolean values now return 0 on success, or a ReportSmith error number on failure.
p. 161
The parameter for TDatabase.ApplyUpdates is now an array of datasets.
pp. 164-165
A new read-only, run-time only Boolean property, TDataSet.UpdatesPending, indicates if there are any records in the update cache that have not been flushed to the database.
True: Updates are pending.
False: No updates are pending.
p. 170
Some keyboard shortcuts for the TUpdateSQL editor have changed or have been removed.
pp. 179-180
Tables 16.2, 16.3, and 16.4 describe the physical data type translations used by TBatchMove when moving data among different databases supported by the BDE. Some of the information in these tables has changed. For example, when moving a dBASE binary field to Paradox, the corresponding Paradox field is a graphics field, not a binary field. For updated translation information, see the Borland Database Engine Online Reference.
Library Reference
=================
Several changes to the VCL and the RTL occurred after the Library
Reference went to print. Most of these changes are recorded in the online
VCL help file. The following changes are noted for their significance.
TBCDField.CurrFormat
--------------------
The CurrFormat property of a TBCDField has been renamed to Currency, and corresponds to the Currency property of a TFloatField or TCurrencyField.
VarToStr standard function
--------------------------
A new function called VarToStr has been added to the System unit.
function VarToStr(const V: Variant): string;
VarToStr converts the given variant to a string. If the variant is Null, an empty string is returned. VarToStr is useful in situations where you want to display a variant value as a string and do not care if the variant is Null, for example
Edit1.Text := VarToStr(OrdersCustNo.Value);
where OrdersCustNo is a field in a database table. Without a call to VarToStr, the above assignment will raise an exception if the field contains Null, since a Null variant cannot be converted to any other type.
TDBCtrlGrid.Orientation
-----------------------
This property requires a value of type TDBCtrlGridOrientation. Valid values are goHorizontal and goVertical.
TReport Properties
------------------
TReport properties that used to return Boolean values now return 0 on success, or a ReportSmith error number on failure.
InterBase Documentation
=======================
For information about updates and corrections to the InterBase documentation that is provided with the Delphi Client/Server Suite and Delphi Developer, see the READIB.TXT file in \Borland\IntrBase.
SQL Links Documentation
=======================
For information about updates and corrections to the SQL Links
documentation, see the READLINK.TXT file in \Borland\Common Files\BDE.
The following help files are provided as part of Delphi 2.0.
All file locations are relative to a default installation path.
Help File Contents
--------- --------
\Bde\Bdecfg32.hlp BDE Configuration Utility help.
\Bde\Localsql.hlp BDE Local SQL help.
\Help\Cwg.hlp Online Component Writer's Guide.
\Help\Dbexplor.hlp SQL Explorer and Database Explorer help.
\Help\Obpascal.hlp Online Object Pascal Language Guide.
\Help\Vcl.hlp Online Library Reference.
\Help\Imagedit.hlp Image Editor help.
\Help\Guide.hlp Microsoft Programmer's Reference.
\Help\Kbase.hlp Microsoft Knowledge Base help.
\Help\Mapi.hlp Microsoft Mail API help.
\Help\Mm.hlp Microsoft Multi-media help.
\Help\Ole.hlp Microsoft OLE help.
\Help\Opengl.hlp Microsoft Open Graphics Library help.
\Help\Rpc.hlp Microsoft Remote Procedure Call API help.
\Help\Win32.hlp Microsoft Windows 32 API help.
\Help\Win32s.hlp Microsoft Windows 32s API help.
\Help\Winsight.hlp Winsight help.
\Help\Tools\hcw.hlp Microsoft help compiler help.
\Quickrpt\Quickrpt.hlp Quick Reports help.
Additional files included in Delphi Developer and Delphi Client/Server
Suite. All file locations are relative to a default installation path.
Help File Contents
--------- --------
\Bde\Bde32.hlp 32-bit Borland Database Engine API help.
\Help\ibctrls.hlp InterBase controls help.
\Help\Pvcs.hlp PVCS and team development interface help.
Additional files included in Delphi Delphi Client/Server Suite. All file locations are relative to a default installation path.
Help File Contents
--------- --------
\Bde\Sqllnk.hlp SQL Links help.
\Bde\Datapump.hlp Data pump expert help.
\Help\Vqb.hlp Visual Query Builder help.
The following section lists changes to the Library Reference, both printed and online.
VCL.HLP:
========
This file contains last minute changes and updates to the Library Reference manual and help file. Use the Index and Search capabilities to examine components, methods, and properties for new information. The following list notes areas of change known not to be in VCL.HLP:
TClipBoard and TPrinter
-----------------------
These are now functions, not variables.
TBytesField and TVarBytesField
------------------------------
These TField objects return a variant array of bytes in response to a Value or AsVariant reference. For TVarBytesField, the first two bytes indicate the length or size of the data, depending on the server.
VarArrayLock and VarArrayUnlock
-------------------------------
These functions now take a const parameter instead of a var parameter.
Support for BDE Input Request Callbacks
---------------------------------------
A new unit, DBInpReq, is provided to support BDE input request callbacks. For more information about BDE input request callbacks, see the BDE online reference.
TDataSet.UpdatesPending property
--------------------------------
A new read-only, run-time only Boolean property, TDataSet.UpdatesPending, indicates if there are any records in the update cache that have not been flushed to the database.
True: Updates are pending.
False: No updates are pending.
TDatabase.ApplyUpdates
----------------------
The parameter for TDatabase.ApplyUpdates is now an array of datasets.
MainThreadID
------------
MainThreadId, defined in CLASSES.PAS, is now public.
The following list identifies additional objects that are not documented
in the VCL.HLP. When information is available elsewhere for an object,
the location of that information appears to the right of the object name. For example, some information is available as a separate DELPHI.HLP help topic, VCL Addendum.
Object Described in
------ ------------
TBits object VCL Addendum help topic
TThread object VCL Addendum help topic
TThreadMethod method Mentioned under TThread methods in
VCL Addendum help topic
TThreadPriority property Mentioned under TThread properties in